package zadanie.s14homerowk.src.streams;

import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.OutputStream;

public class ReplacerOutputFilter extends FilterOutputStream {

	private char space;
	private char pipe;

	public ReplacerOutputFilter(OutputStream out, char space, char pipe) {
		super(out);
		setSpace(space);
		setPipe(pipe);
	}

	@Override
	public void write(int b) throws IOException {
		if (b == space) {
			b = pipe;
		}
		super.write(b);
	}

	public char getSpace() {
		return space;
	}

	public void setSpace(char space) {
		this.space = space;
	}

	public char getPipe() {
		return pipe;
	}

	public void setPipe(char pipe) {
		this.pipe = pipe;
	}

}
